//
//  DBCommunicator.h
//  Seizure
//
//  Created by student on 2/23/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Account.h"
#import <CommonCrypto/CommonDigest.h>
#import "LinkedAccount.h"
#import "NetworkData.h"
#import "EventLog.h"

@interface DBCommunicator : NSObject

- (void) registerUser:(Account*)user password:(NSString*)password delegate:(id<NetworkData>)delegate requestType:(short)rtype;
- (void) loginUser:(NSString*)email password:(NSString*)password delegate:(id<NetworkData>)delegate requestType:(short)rtype;
- (BOOL) resetPassword:(NSString*)email;

- (NSString*)createPatientCaretakerConnection:(Account *)requestingAccount emailOfRequested:(NSString *)email;
- (BOOL)removePatientCaretakerConnection:(Account *)initiatingAccount emailToDisconnect:(NSString *)email;
- (BOOL)confirmPatientCaretakerConnection:(NSString *)caretakersEmail;

- (BOOL)updatePatientSensitivity:(NSString *)patientEmail sensitivity:(NSNumber *)sensitivity;
- (NSNumber*)getPatientSensitivity:(NSString *)patientEmail;

- (NSArray*) fetchCaretakers:(NSString*)email target:(id<NetworkData>)target requestType:(int)rtype;
- (LinkedAccount *) fetchPatient:(NSString *)email;

+ (UIAlertView*)createLoadingAlert;
- (void) uploadAPNSKey:(NSString*)key toUser:(NSString*)email;

- (void)addPatientEventLog:(NSString *)formattedStart withEndTime:(NSString *)formattedEnd withLatitude:(NSNumber *)latitude withLongitude:(NSNumber *)longitude withAccuracy:(NSNumber *)accuracy forPatient:(NSString *)patientEmail;
- (NSArray*)getPatientEventLogs:(NSString *)requestingEmail forAccountType:(NSString *)accountType target:(id<NetworkData>)target requestType:(int)rtype;

- (void)pushAlertForPatient:(NSString*)email location:(CLLocation*)location;

@end
